跳到主要内容

SetValue

Sets a value to the current cell or cell range.

Syntax

expression.SetValue(data);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
dataRequiredstringboolnumber

Returns

boolean

Example

This example sets a value to cells.

var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("B1").SetValue("2");
oWorksheet.GetRange("B2").SetValue("2");
oWorksheet.GetRange("A3").SetValue("2x2=");
oWorksheet.GetRange("B3").SetValue("=B1*B2");